clear all;
close all;
clc

%不同的计算机需要修改此处的地址以调用txt文件
data=load('/Users/tingting/Desktop/p_C.txt');
d=data(:,1);
c=0;
figure;
hold on;
x=-1:0.001:1;
for n=5:5:20
   y=zeros(1,2001);
    for i=0:n-1
        for j=1:2001
        y(j)=y(j)+d(c+i+1)*x(j)^(n-1-i);
        end
    end
    l(n)=plot(x,y,'Linewidth',2);
    c=c+n;
end
fff=fplot('cc',[-1,1],'Linewidth',2);
legendText = legend([l(5),l(10),l(15),l(20),fff],'n=5','n=10','n=15','n=20','f(x)','FontSize', 18,'FontName','problem_E 2','location','northeast');